package models

import (
	"github.com/jinzhu/gorm"
	"kop/modules/role/entity"
)

func GetRolePay(dB *gorm.DB, roleID int32) entity.RolePay {

	var data = entity.RolePay{
		RoleID: roleID,
	}

	if err := dB.FirstOrCreate(&data).Error; err != nil {
		panic(err)
	}

	return data
}

func SaveRolePay(dB *gorm.DB, pay *entity.RolePay) {

	if err := dB.Save(pay).Error; err != nil {
		panic(err)
	}
}
